package org.springcloud.wisdom.spring_01_canteen.mall;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springcloud.wisdom.spring_01_canteen.login.entity.Mall;

import java.util.List;


@Mapper
public interface MallDao {
    //查看所有商家（可以根据食堂查询）
    //分页查询
    @Select("<script>" +
            "SELECT * FROM wisdom.mall" +
            "<where>" +
            "   <if test=\"canteen != null\">" +
            "       canteen = #{canteen}" +
            "   </if>" +
            "</where>" +
            "limit #{start},#{size}" +
            "</script>")
    List<Mall> mall(int start, int size, String canteen);
    @Select("<script>" +
            "SELECT count(*) FROM wisdom.mall" +
            "  <where>" +
            "    <if test=\"canteen != null\">" +
            "      canteen = #{canteen}" +
            "    </if>" +
            "</where>"+
            "</script>")
    public int countMall(String canteen);
}
